import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _createClass from 'babel-runtime/helpers/createClass';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
/**
 * 判断是否有子菜单, 无子菜单不显示
 * @author: ljq
 * @since: 2019-01-12 15:46:51
 */
import * as React from 'react';
import { Menu } from 'antd';
var SubMenu = Menu.SubMenu;

var SubMenuHasChild = function (_React$Component) {
    _inherits(SubMenuHasChild, _React$Component);

    function SubMenuHasChild() {
        _classCallCheck(this, SubMenuHasChild);

        var _this = _possibleConstructorReturn(this, (SubMenuHasChild.__proto__ || Object.getPrototypeOf(SubMenuHasChild)).apply(this, arguments));

        _this.getSubMenu = function () {
            var children = _this.props.children;

            if (children) {
                return React.createElement(
                    SubMenu,
                    _this.props,
                    children
                );
            } else {
                return '';
            }
        };
        return _this;
    }

    _createClass(SubMenuHasChild, [{
        key: 'render',
        value: function render() {
            return this.getSubMenu();
        }
    }]);

    return SubMenuHasChild;
}(React.Component);

export default SubMenuHasChild;